import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.List;


public class FileNameExtensionFilter implements FilenameFilter {
	private List<String> allowedExtensions = new ArrayList<String>(2);

	public FileNameExtensionFilter(String... extensions) {
		for(String extension : extensions) {
			allowedExtensions.add(extension);
		}
	}

	@Override
	public boolean accept(File dir, String filename) {
		for(String extension : allowedExtensions) {
			if(filename.endsWith(extension)) {
				return true;
			}
		}
		return false;
	}

}
